/* -*- Pascal -*- */

$C
COMPILER alvo

#include "alvopp.hh"
AlvoPP psr;
void**alvo_closure;

/*--------------------------------------------------------------------------*/

CHARACTERS
  letter   = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".
  digit    = "0123456789".
  /*digit = "0".."9".*/
  cntl     = CHR(0)..CHR(31).
  tab      = CHR(9) .
  cr       = CHR(13).
  lf       = CHR(10) .
  back     = CHR(92) .
  
  noQuote1 = ANY - '"' - cntl - back .
  noQuote2 = ANY - "'" - cntl - back .
  graphic  = ANY - cntl .
  
  symboli  = ANY - cntl - back - CHR(32).
  
  dot      = '.'.
  identi   = "_$".
  quot     = '"'.
  /*semic = ";".*/
  /*noQuote1 = ANY - '"' - cntl - back .
  noQuote2 = ANY - "'" - cntl - back .*/
  notQout = ANY - quot.

TOKENS
  /*symbol     = letter  {letter | digit | identi}.*/
  symbol     = letter  {symboli}.
  /*xxxxxx     = digit   {digit}.*/
  /*integral   = xxxxxx ./ *[ ( 'e' | 'E' ) digiti ].*/
  /*integral   = digit   {digit}.*/
  /*fractional*/numeric = digit   {digit} [dot digit {digit}].
  semi       = ";".
  string     = quot {notQout} quot.

IGNORE cr + lf + tab

COMMENTS FROM "--" TO lf

PRODUCTIONS

alvo=Alvo (.*alvo_closure=psr.Result;/*closure=psr.Result;*/.).
Alvo =
  { Expr }
  .
  
Expr =
    '(' (.psr.sg();.) { Expr } ')'  (.psr.eg();.)
  | '[' (.psr.sl();.) { Expr } ']'  (.psr.el();.)
  | '{' (.psr.sz();.) { Expr } '}'  (.psr.ez();.)
  | [ Factor ]
  .
  
Eval = 
  "/" (.psr.eval();.) symbol (.psr.symbol();.)
  .

Factor =
    Eval
  | string   (.psr.stringular();.)
  | symbol   (.psr.symbol();.)
  | numeric  (.psr.numeric();.)
  .
  
END alvo.
